Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

417
Views
Form/Data Body returns [Object: null prototype] { id: 'df4f8rfrf' } in nestjs / nodejs

I follow this link but it's not working for me. When I am trying to pass form data to my database, My controller returns

categories: [Object: null prototype] { id: '3a0e56cc-5670-4dcc-9bbd-8ef38d2b1535' }

But I don't know the reason. The data should return like this: enter image description here

This is my code :

 @Post()
  @UseInterceptors(FileInterceptor('image'))
  async create(
    @UploadedFile() file: Express.Multer.File,
    @Body() createItemDto: CreateItemDto,
  ) {
    console.log('createItemDto', createItemDto);
    try {
      const item = await this.itemService.create(createItemDto);
      if (item) {
          return {
            statusCode: HttpStatus.OK,
            message: 'Item created successfully',
            item,
             };
      }

    } catch (error) {
      return {
        message: error.detail,
      };
    }
  }

This is what my error looks like : I really need your all help. Because I have no idea about this. enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

There is probably a better way to do this but I did something like this:

const obj = JSON.parse(JSON.stringify(abc)); // abc = [Object: null prototype] { id: '123' }

console.log(obj); // { id: '123' }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!